// pages/pinche/list/list.js
var util = require('../../../utils/util.js');
var app = getApp();
var today = util.formatTime(new Date((new Date()).getTime() + (1000 * 60 * 60 * 24 * 1))).split(' ')[0];
var minday = util.formatTime(new Date()).split(' ')[0];
var maxday = util.formatTime(new Date((new Date()).getTime() + (1000 * 60 * 60 * 24 * 62))).split(' ')[0];

Page({

  /**
   * 页面的初始数据
   */
  data: {
    detailUrl: "./evaluation/evaluation",
    location: ['请选择', '邯郸', '张江', '枫林', '江湾'],
    startLocation: 0,
    endLocation: 0,
    compeleIssueList: [
      {
        placeFrom: "张江",
        placeTo: "邯郸",
        date: "2018-4-18",
        time: "17:30",
        passengerNum: 3,
        pincheId: 123456
      },
      {
        placeFrom: "张江",
        placeTo: "邯郸",
        date: "2018-4-18",
        time: "17:30",
        passengerNum: 3,
        pincheId: 123456
      },
      {
        placeFrom: "张江",
        placeTo: "邯郸",
        date: "2018-4-18",
        time: "17:30",
        passengerNum: 3,
        pincheId: 123456
      }
    ],
    date: today,
    start: minday,
    end: maxday,
    time: '12:00'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      switch(options.kind){
        case "current":
          this.setData({
            detailUrl: "./detail/detail?kind=current"
          });
          break;
        case "passing":
          this.setData({
            detailUrl: "./detail/detail?kind=passing"
          });
          break;
        case "can":
          this.setData({
            detailUrl: "./detail/detail?kind=can"
          });
          break;
        case "evaluation":
          this.setData({
            detailUrl: "./evaluation/evaluation?kind=evaluation"
          });
          break;
        case "history": 
          this.setData({
            detailUrl: "./detail/detail?kind=history"
          });
        default:
          this.setData({
            detailUrl: "./detail/detail?kind=none"
          });
      }
  },

  detailTap: function() {
    var that = this;
    wx.navigateTo({
      url: that.data.detailUrl,
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },
  
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})